import os

'''
自动创建目录
'''
# 定义一级目录及对应的二级目录
directories = {
    "1. API 网关": ["Spring Cloud Gateway", "Zuul", "APISIX", "Kong", "Nginx", "Soul"],
    "2. 服务调用": ["Dubbo", "Ribbon + Feign", "gRPC", "SOFARPC", "Motan"],
    "3. 消息队列": ["RocketMQ", "Kafka", "RabbitMQ", "ActiveMQ"],
    "4. 作业调度": ["Elastic Job Lite", "Elastic Job Cloud", "Quartz", "XXL-Job"],
    "5. 注册中心": ["Eureka", "Nacos", "Zookeeper", "Consul", "Etcd"],
    "6. 配置中心": ["Apollo", "Nacos", "Spring Cloud Config", "Disconf"],
    "7. 链路追踪": ["SkyWalking", "Zipkin", "CAT", "Pinpoint"],
    "8. 服务保障": ["Hystrix", "Sentinel", "Resilience4j"],
    "9. 服务器": ["Netty", "Tomcat", "Jetty", "Nginx"],
    "10. Java": ["Java 面试题", "JDK 源码", "Java 并发", "JVM 虚拟机"],
    "11. J2EE": ["Spring", "Spring Boot", "Spring Cloud & Spring Cloud Alibaba"],
    "12. Web 框架": ["Spring MVC", "Spring Webflux", "WebSocket", "Web Services"],
    "13. 安全框架": ["Spring Security", "Shiro", "OAuth 2.0"],
    "14. ORM 框架": ["MyBatis", "Hibernate", "Spring Data JPA"],
    "15. 数据库连接池": ["HikariCP", "Druid", "多数据源 && 读写分离"],
    "16. 数据库中间件": ["Sharding JDBC", "Sharding Sphere", "MyCAT", "Canal"],
    "17. 分布式事务": ["TCC Transaction", "Seata", "Fescar", "Happylifeplat TCC"],
    "18. 数据库": ["MySQL", "Redis", "MongoDB", "TiDB"],
    "19. 搜索引擎": ["Elasticsearch", "Solr", "Lucene"],
    "20. 工具类": ["RxJava", "Guava"],
    "21. 自我修养": ["设计模式", "数据结构与算法", "性能测试"],
    "22. 容器服务": ["Linux", "Docker", "Kubernetes", "Swarm"],
    "23. 开发工具": ["Git", "Maven", "Jenkins", "IntelliJ IDEA"],
    "24. 监控体系": ["ELK", "Prometheus", "Spring Boot Admin", "CAT", "Sentry"],
    "25. 前端框架": ["React", "Vue", "Angular"],
    "26. 大数据": ["HBase", "Hive", "Spark", "Flink"],
    "27. 其它语言": ["Go", "Python"]
}



# 指定根目录
root_dir = r"E:\资料-学习\1.信息技术资料\芋道\源码系列\《微服务及扩展》"

def create_directories():
    for level1_dir, level2_dirs in directories.items():
        level1_path = os.path.join(root_dir, level1_dir)
        os.makedirs(level1_path, exist_ok=True)
        for level2_dir in level2_dirs:
            level2_path = os.path.join(level1_path, level2_dir)
            os.makedirs(level2_path, exist_ok=True)
            print(f"Created directory: {level2_path}")

if __name__ == "__main__":
    create_directories()
